import axios from 'axios'
import MockAdapter from 'axios-mock-adapter'
import Demo from './demo'
import app from './app'

export default {
  /**
   * mock bootstrap
   */

  bootstrap () {
    const mock = new MockAdapter(axios)
    let URL = process.env.VUE_APP_BASE_CUSTOMER
    // mock.onGet('/verify/graph').reply(200, Account.getGraph())

    // mock.onGet('/user/login').reply(200, Account.login())

    // mock.onGet('/public/checkToken').reply(200, Account.check())

    // mock.onGet('/user/info').reply(200, Account.getUserInfo())

    // mock.onGet('/user/menus').reply(() => {
    //   return new Promise((resolve) => {
    //     setTimeout(() => {
    //       resolve([200, Account.getMenus()])
    //     }, 1000)
    //   })
    // })

    mock.onGet(URL + '/user/listpage').reply(config => {
      return new Promise((resolve) => {
        setTimeout(() => {
          resolve([200, Demo.getUserList(config)])
        }, 1000)
      })
    })
    mock.onGet(URL + '/user/getData').reply(() => {
      return new Promise((resolve) => {
        setTimeout(() => {
          resolve([200, Demo.getData()])
        }, 1000)
      })
    })
    app.doAppMock()
    mock.onAny().passThrough()
  }

}